package inventory.service.impl;

import inventory.entity.InRepositoryRecord;
import inventory.entity.User;
import inventory.mapper.UserMapper;
import inventory.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;
    public int  modifyById(User user){
       return userMapper.updateByPrimaryKey(user);
    }

    @Override
    public int deleteUserById(String id) {
       int  primaryKeyrimaryKey= userMapper.deleteByPrimaryKey(id);
       return primaryKeyrimaryKey;
    }

    @Override
    public User queryUserById(String id) {

        return userMapper.selectByPrimaryKey(id);
    }

    @Transactional
    @Override
    public void insert(User user) {
        userMapper.insert(user);
//        int i = 1/0;
    }
}
